# Python RIBClient
PROJECT (PythonRIBClient)

IF (WIN32)
  SET (CMAKE_BUILD_TYPE "Release")
ENDIF (WIN32)

INCLUDE(FindPythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})

INCLUDE_DIRECTORIES ( . )
INCLUDE_DIRECTORIES ( ../utils )
# INCLUDE_DIRECTORIES ( $ENV{CPPUNIT_ROOT}/include )
INCLUDE_DIRECTORIES ( $ENV{PYTHON_INCLUDE} )

# LINK_DIRECTORIES ( $ENV{CPPUNIT_ROOT}/lib )

SET(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/python)
SET_SOURCE_FILES_PROPERTIES( RIBClient.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES( RIBClient.i PROPERTIES CMAKE_SWIG_FLAGS "-includeall -o RIBClientPYTHON_wrap.cxx")

SWIG_ADD_MODULE ( ribclient python RIBClient.i ParameterList.cpp )
SWIG_LINK_LIBRARIES ( ribclient ${RIBCLIENT_LIBRARIES} utils ${PYTHON_LIBRARIES} )

IF (WIN32)
  SET_TARGET_PROPERTIES ( _ribclient PROPERTIES SUFFIX ".pyd")
ENDIF (WIN32)

IF (APPLE)
  SET_TARGET_PROPERTIES ( _ribclient PROPERTIES
    LINK_FLAGS "-undefined dynamic_lookup")
ENDIF (APPLE)

INSTALL ( TARGETS _ribclient
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})

INSTALL ( FILES ${CMAKE_BINARY_DIR}/python/ribclient.py
  DESTINATION ${CMAKE_INSTALL_PREFIX})

IF (WIN32)
  SET ( CPACK_GENERATOR "ZIP" )
ENDIF (WIN32)
INCLUDE (CPack)
